# Contributor: Jakub Panek <me@panekj.dev>
# Maintainer: Jakub Panek <me@panekj.dev>
pkgname=reproc
pkgver=14.2.4
pkgrel=0
pkgdesc="Cross-platform (C99/C++11) process library"
url="https://github.com/DaanDeMeyer/reproc"
arch="all"
license="MIT"
makedepends="cmake samurai"
subpackages="$pkgname-dev"
source="https://github.com/DaanDeMeyer/reproc/archive/v$pkgver/reproc-$pkgver.tar.gz"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DREPROC++=ON \
		-DREPROC_TEST=ON \
		$CMAKE_CROSSOPTS .
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
c592521960f1950d626261738091d25efdf764ee1a0c72a58c28c66eaebf6073b2c978f1dc2c8dbe89b0be7ec1629a3a45cb1fafa0ebe21b5df8d4d27c992675  reproc-14.2.4.tar.gz
"
